%************* Calculation of heat transfer between steam and cooling tubes********

%Aim:

%1) Calculation of steam flow and energi 
%2) Calculation of heat exchange capacity for set amount of tubes and
%specifications

%Litterature
% - Heat And Mass Transfer A Practical Approach

%Steam flow

%Steam flow is produced by evaporation og water and ethanol from mesh in
%the boiler. The system is in steady state. The amount of energi stored in the steam and is dependent on
%the effect provided by the heating element, the effectivness of the element
%and the energi loss to the surroundings. A crude implementations of these
%have been used by applying factors.


%Specifikcations:
P_heater = 1500; %J/s
Lv_w = 2.26e007; %J/kg
ef_h = 0.80; % Effectivness of the heating element
ef_b = 0.60; % Energy loss to the surroundings


%Calculations

P_kolonne = P_heater*ef_h*ef_b;
N_steam = P_heater*ef_h*ef_b/Lv_w; %kg/s



%Heat exchange capacity for the cooling tubes installed in a single column
%tube bank in a destillation column.

%////Specifications////

% Ideally mixed crossflow
% Heat transger coefficient is affected by the difference in inner and
% outer surface area

%Dimensions
n = 10; %number of tubes
r_pipe_y = 0.015; %m outer radius of tube
L_pipe = 0.049; %m lengthe of tube exposed to steam
b_pipe = 0.0015; %m material thickness
r_pipe_i = r_pipe_y-b_pipe; %m inner radius
L_space = 0.030; %m perimeter to perimeter distance between tubes

% Temperatures
T_water_i = 10; %Celcius Cooling water in T
T_water_y = 70; %Celcius Cooling water out T

T_damp_i = 100; %Celcius Steam in T
T_damp_y = 65; %Celcius Steam out T

c_w = 4186; % J/kg*K specific heat capacity for water
T_sat = 100; % Kelvin The boiling point of water

%Random constants
g = 9.80; %m/s^2 gravity accerleration
p_w = 971.8;% kg/m^3 water density (at X degrees?)
p_s = 0.2935;% kg/m^3 steam density (at X degrees?)
my_w = 0.355e-003;% waters viscosity

% Heat transfer coefficients
k_w = 0.67;% W/m*K waters rate of heat conduction
h_iv = 1/0.0001; % W/m^2*C heat transfer coefficient through a liquid film. Flow analysis should be conducted
k_ss = 80.2; % W/m*C rate of heat conduction through stainless steel
h_ig = 1/0.00005; % W/m^2*C heat transfer coefficient through steam film.
h_ivk = 0.729*((g*p_w*(p_w-p_s)*Lv_wk*k_w^3)/(my_w*(T_sat-Tm_s)*n*D_pipe_y))^0.25; %  heat transfer coefficient through a liquid film corrected on the basis of horizontal tube banks theory.


%////Calculations////

%*****Dimensions******
rm = (r_pipe_y-r_pipe_i)/log(r_pipe_y/(r_pipe_i)); %m logarithmic mean radius
Dm = 2*rm; %m logarithmic mean diameter
D_pipe_i = 2*r_pipe_i; %m inner diameter
D_pipe_y = 2*r_pipe_y; %m outer diameter
Ai_pipes = 2*(r_pipe_i)*pi*L_pipe*n; %Sum of inner surface area of all tubes

%*****Temperature******

Tm_s = (T_water_y-T_water_i)/log(T_water_y/T_water_i); % Guess of mean surface temperature (Ts) on the colling tubes

%Correction of the latent heatcapacity for water, in order to approximate
%condensation on tube banks

Lv_wk = Lv_w + 0.68*c_w*(T_sat-Tm_s);


%Overall transport coefficient, where surface area difference is taken into
%account

Ui = 1/(1/h_iv + b_pipe/(Dm/D_pipe_i*k_ss) + 1/(D_pipe_y/D_pipe_i*h_ivk)+ 1/(D_pipe_y/D_pipe_i*h_ig)); % Overall transfer coefficient calculated on the basis of r_i

%Log mean temperature difference for counterflow arrangement:

dT1 = T_damp_i- T_water_y;
dT2 = T_damp_y - T_water_i;
dTm = (dT1 - dT2)/log(dT1/dT2);

%Correction factor values

P = (T_water_y-T_water_i)/(T_damp_i-T_water_i);
R = (T_damp_i-T_damp_y)/(T_water_y-T_water_i);
F = 0.95; % P = 0.222 og R = 1.75000 er brugt til at bestemme F. Findes der en
%algorithme?

Q_c = Ui*Ai_pipes*F*dTm %J/s

%How much water?
F_w = Q_c/(c_w*(T_water_y-T_water_i)) % L/s

F_w_hr = F_w*3600 % L/hr

